﻿using System;
using System.Collections.Generic;
using StockTrader.BusinessService.DataContract;

namespace StockTrader.FrontEnd.DataContract
{
    public class IndustryUI
    {
        private int _id;
        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }
        private string _name;
        public string Name
        {
            get { return _name.Trim(); }
            set { _name = value.Trim(); }
        }
        private string _code;
        public string Code
        {
            get { return _code; }
            set { _code = value.Trim(); }
        }
        private int _classification;
        public int Classification
        {
            get { return _classification; }
            set { _classification = value; }
        }
        private string _classificationText;
        public string ClassificationText
        {
            get { return _classificationText; }
            set { _classificationText = value.Trim(); }
        }
        private int _beLongTo;
        public int BeLongTo
        {
            get { return _beLongTo; }
            set { _beLongTo = value; }
        }
        private string _beLongToText;
        public string BeLongToText
        {
            get { return _beLongToText; }
            set { _beLongToText = value; }
        }
        private string _definition;
        public string Definition
        {
            get { return _definition; }
            set { _definition = value; }
        }
        private string _lang;
        public string Lang
        {
            get { return _lang; }
            set { _lang = value; }
        }
        private int _langId;
        public int LangId
        {
            get { return _langId; }
            set { _langId = value; }
        }
        private List<IndustryUI> _child;
        public List<IndustryUI> Child
        {
            get { return _child; }
            set { _child = value; }
        }
        private int _level;
        public int Level
        {
            get { return _level; }
            set { _level = value; }
        }
        public IndustryUI()
        {
            this._level = -1;
        }
        public IndustryUI(int id, string name, string code, int classification, string classificationtext,int belongto, string belongtotext, string definition, string lang, int langid, int level, List<IndustryUI> child )
        {
            this._id = id;
            this._name = name;
            this._code = code;
            this._beLongTo = belongto;
            this._definition = definition;
            this._lang = lang;
            this._beLongToText = belongtotext;
            this._langId = langid;
            this._child = child;
            this._level = level;
            this._classification = classification;
            this._classificationText = classificationtext;
        }
        public IndustryUI(IndustryData item)
        {

        }
        public IndustryData ConvertToData()
        {
            IndustryData item = new IndustryData();
            item.Name = this._name;
            item.Code = this._code;
            item.BelongTo = this._beLongTo;
            item.Definition = this._definition;
            item.LangId = this._langId;
            item.Level = this._level;
            item.Classification = this._classification;
            return item;
        }
        public override string ToString()
        {
            if (this._name != null)
                return this._name.Trim();
            else
                return String.Empty;
        }
    }
}
